#!/bin/bash
#
# usage: icpc-run-python program.py file1.in file2.in file3.in 
if test $# -le 1; then
  echo "usage: icpc-run program.py files";
  exit 1;
fi
program_file=$1
echo running program ${program_file}
echo
j=1
for file; do
  if [ $j -ge 2 ]; then
    input_file=$file 
    output_file="${input_file%.in}.ans"
    if [ -f $output_file ]; then 
        echo python $program_file <  $input_file > .temp.ans
        python $program_file < $input_file > .temp.ans
        echo ${input_file}
        if diff -b .temp.ans ${output_file} > /dev/null; then 
            echo -e "\\t" Success
        else 
            echo -e "\\t" Failure
        fi 
    fi 
  fi
  j=$[ $j + 1 ];
done

